home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Magnum One
/
Magnum One (Mid-American Digital) (Disc Manufacturing).iso
/
d21
/
just1v12.arc
/
READ.ME
< prev
Wrap
Text File
|
1991-07-25
|
8KB
|
195 lines
JUSTONE (Version 1.1)
(c) Copyright 1991 Heartsong Productions (tm)
Overview
========
JUSTONE is a program designed for the DESQView (tm) multi-tasking
environment. It can be used to prevent multiple instances of the same
program from running, or it can be used to prevent contention from
programs that use the same resources.
JUSTONE makes use of the Shared Program facility of DESQView. In case
you aren't familiar with it, here is a brief explanation:
Most programs run under DESQView need to have their own address space to
ensure that they do not collide with each other. This is because most
DOS programs don't need to communicate directly with other programs.
However, under DESQView, you may want to be able to have two different
programs communicate directly while they are running. The Shared
Program feature provides this facility.
A Shared Program is a program written specifically for DESQView that is
loaded when you start up a program that makes reference to it in its
PIF file (the Change Program screen in DESQView). When a second
program is run that makes reference to the same Shared Program, rather
than using up additional memory resources loading a second copy of it,
DESQView simply gives the second program access to the same copy as the
first program. If this sounds like it might confuse things, it very
well could, except that DESQView gives the Shared Program clues about
which program is running, so that it can keep things straight. Shared
Programs are specific to DESQView and cannot be run from the command
line.
JUSTONE runs as a Shared Program. Each time you run a program that
calls out JUSTONE, DESQView gives JUSTONE control just long enough for
it to look at the Shared Data from the PIF file. This data field is an
ASCII field where JUSTONE expects to find the name of a semaphore. It
then searches its list to see if any other program is currently using
that semaphore, and if so, it displays an error message and switches to
the original instance of the program. If there is no other program
using the semaphore, JUSTONE creates a semaphore and the program is
allowed to run. When the program exits, DESQView removes the semaphore
from its list, so that next time, the program can run again.
Installation
============
Installation of JUSTONE is very simple. Copy the JUSTONE.SHP file to a
directory in your PATH. I recommend that you copy it to your /DV
directory.
Using JUSTONE
=============
To use JUSTONE, you will need to modify the PIF file of the program(s)
you want to control. Tap the {DESQ} key (usually <Alt>), then select
CP (Change Program) from the menu. After selecting the program you
want to change, the Change Program screen should come up. You are
looking at the PIF file. The fields we are interested in are on the
second page. Press the F1 key to get to the second page. Use the
mouse, cursor keys, or tab key to move the cursor to the Shared Program
block, specifically the Pathname field. Type "JUSTONE.SHP" and press
the Tab key or cursor keys to move to the Data field. Type in a unique
name, up to 64 characters into this field. This is the semaphore name.
Press the <Enter> key when you are finished, and that's it.
To test, start up a copy of the program you just modified. Now try to
run a second copy. You should see an error message telling you that
only one instance of the program is allowed.
Controlling Access To Resources
===============================
Sometimes you also want to be able to control access to a single
device, like a printer or a modem. But you may have multiple programs
that access it. To ensure that only one is running at any one time,
give all of the programs the same semaphore name. Say, for instance,
that you have a terminal program for communications with the modem, but
you also have a dialing program that you use to speed-dial numbers for
you. It would be pretty disastrous if they both tried to access the
modem at the same time. By putting the semaphore name "Modem" in both
program's Shared Program:Data field, only one will be allowed to run at
a time. You can use this same technique to control access to files, or
other resources.
CHKSEMA4
========
CHKSEMA4 is a program that allows you to check to see if a specific
semaphore is in use. As an example, let's say that you have used the
semaphore name "Modem" to control access to your modem. You can check
to see if the semaphore is being used in a batch file as follows:
chksema4 Modem
if not errorlevel 1 goto exit
echo Semaphore is in use
:exit
As you can tell from the previous example, CHKSEMA4 returns a 0 if the
semaphore is not in use, or a 1 if it is in use. It also returns a 2
if you fail to specify a semaphore on the command line. The included
CHK.BAT file is a simple example of batch file usage of CHKSEMA4.
CHKSEMA4 is particularly useful in combination with EXEC which allows
you to start background tasks from the command line or a batch file.
You can check a semaphore, then start a task only if the semaphore is
unlocked (or locked, if you choose).
Error Messages
==============
"A non-swappable window is in the way"
Shared Programs require access to shared memory, which is
located in conventional RAM. If you open a window that uses up
all of the conventional memory first, then DESQView does not
have memory to load the Shared Program. You can prevent this
by running DESQView with the /MS option. "/MS=1" will reserve
1K of shared memory for use by Shared Programs. If you are
using other Shared Programs, you may need to increase this
number.
"Must have a semaphore name in the shared data field"
The semaphore name is a required field. You must enter at
least one non-blank character into this field.
"Only one instance of this program allowed.
Switching to original instance..."
This is the message you will get when you try to run a second
program that uses the same semaphore. You will need to close
the first window before opening the second.
"Out of common memory"
JUSTONE uses Common Memory to keep track of the semaphores. If
you receive this message, you don't have enough to open another
window as a shared program. In fact, you are probably very
near to not being able to do anymore with DESQView. If you
have this happen often, you should run DESQView Setup and
allocate more Common Memory in the advanced options.
Acknowledgements
================
I'd like to acknowledge Phil Graham for providing me with the method
used to switch to the original program instance reliably. I beat my
head against the wall trying to come up with something that worked,
including all kinds of hare-brained schemes, while Phil came up with
simple elegant solution.
License And Disclaimer
======================
JUSTONE is distributed as shareware. The registration fee is $10 US,
(money order or check drawn on a US Bank) which will entitle you to
telephone support and upgrade notices. For a $15 registration, you
will also receive the source code (please specify disk format). The
DESQView API manual and diskette are required to assemble the source
code. Registrations should be sent to the address below:
Heartsong Productions
1 Tankers Road
Scotts Valley, CA 95066
(408) 438-5506 (voice & fax)
BIXname "dsparks"
JUSTONE is supplied on an as-is basis only. Heartsong Productions
offers no warranty, express or implied, and will assume no liability
as to the merchantibility or fitness to any purpose of this software,
nor any liability for direct, indirect, special, incidental or
consequential damages as a result of defects in this software or its
documentation, even if advised of the possibility of such damages.
Other DESQView Software Available From Heartsong Productions
============================================================
EXEC - A DOS command line program for starting up DESQView tasks. You
can start up a background task and have the program beep when it is
finished, all from the comfort of your DOS command line. Great for
compiling programs or other background tasks that don't require input.
TradeMarks
==========
Heartsong Productions is a trademark of Heartsong Productions
DESQView is a trademark of Quarterdeck Office Systems